<div id='cd_stage_<%= @stage.id %>_form' class='new_or_edit'>
  <div class='form'>
    <dl>
      <dt><%= @stage.name %>-分类：</dt>
    </dl>
    <% WorkItemType.all.each do |type| %>
      <div class='item'>
        <div class='name'><%= type.name %></div>
        <div id='cd_work_item_type_<%= type.id %>_stage_<%= @stage.id %>_tool' class='tools'>
          <% if @stage.work_item_types.include?(type) %>
            已加入
          <% else %>
            <%= link_to_remote '加入',
                  :update => "cd_stage_#{@stage.id}",
                  :url => work_item_type_stages_url(
                    :stage_id => @stage.id,
                    :work_item_type_id => type.id
                  ),
                  :loading => "$('cd_work_item_type_#{type.id}_stage_#{@stage.id}_tool').update('处理中')",
                  :method => :post,
                  :html => {
                    :class => :base
                  }
                %>
          <% end %>
        </div>
      </div>
    <% end %>
  </div>
  <div class='buttons'>
    <%= link_to_function '返回', "Effect.Fade('cd_stage_#{@stage.id}_form')", :class => 'go_back button' %>
  </div>
</div>